package com.mianshi;

import java.util.HashMap;
import java.util.Scanner;

public class Jd2 {
    static class Location{
        public int x;
        public int y;

        public Location(int x, int y){
            this.x = x;
            this.y = y;
        }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        int y = in.nextInt();
        int z = in.nextInt();
        HashMap<Character, Location> map = new HashMap<>();
        for(int i = 0; i < n; i++){
            String line = in.next();
            for(int j = 0; j < m; j++){
                map.put(line.charAt(j), new Location(i,j));
            }
        }
        String input = in.next();
        Long output = 0L;
        Location lastLocation = new Location(0,0);
        for(char c : input.toCharArray()){
            Location location = map.get(c);
            if(lastLocation.x == location.x && lastLocation.y == location.y){
                output += z;
            } else if(lastLocation.x == location.x && lastLocation.y != location.y){
                output += Math.abs(lastLocation.y - location.y) * y;
                output += z;
            } else if(lastLocation.x != location.x && lastLocation.y == location.y){
                output += Math.abs(lastLocation.x - location.x) * x;
                output += z;
            } else {
                output += Math.abs(lastLocation.y - location.y) * x;
                output += Math.abs(lastLocation.x - location.x) * x;
                output += y;
                output += z;
            }
            lastLocation = location;
        }
        System.out.println(output);
    }
}
